<?php
include_once("../initial.php");
include_once("../driver/drive.php");
include_once("../driver/tableLocation.php");
include_once("../global/global_function.php");
class roleRHandle
{
    public function get_all_data()
    {
        $tablename = tableLocation::roleTable();
        $sql = "select * from $tablename where `check`='Y' order by id desc";
        return drive::get_all_rows($sql);
    }
    public function get_role_num($array)
    {
        $tablename = tableLocation::roleTable();
        $sql = get_select_sql($tablename, "count(*)", $array);
        $result = drive::get_one_value($sql);
        return $result;
    }
    public function get_some_data($array, $orderby='', $limit='')
    {
        $tablename = tableLocation::roleTable();
        $sql = "select * from $tablename where ";
        $first=0;
        foreach($array as $key=>$value)
        {
            if($first==0)
            {
                $sql .= "$key='$value' ";
                $first=1;
            }
            else
            {
                $sql .= "and $key='$value'";
            }
        }
        $sql .= " $orderby $limit";
        return drive::get_all_rows($sql);
    }
}
?>﻿